package com.appkubes.mall.restful.application.brand.goods.dao;

import com.appkubes.mall.restful.application.goods.taobao.entity.dto.GoodsTaobaoListDto;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: Lin Jiaming
 * @Date: 2020/3/7 20:07
 * @Description:
 */
@Mapper
public interface BrandGoodsDao {

    @Select("<script>" +
            "SELECT goods.* FROM mall_brand_goods AS brand_goods LEFT JOIN mall_goods_taobao AS goods ON brand_goods.goods_key=goods.goods_key " +
            "WHERE brand_goods.brand_key='${brandKey}' " +
//            "<when test='sort==zx'>" +
//            "ORDER BY goods.create_time DESC" +
//            "</when>" +
//            "<when test='sort==sell'>" +
//            "ORDER BY goods.month_sales DESC" +
//            "</when>" +
//            "<when test='sort==jgdown'>" +
//            "ORDER BY goods.actual_price DESC" +
//            "</when>" +
//            "<when test='sort==jgup'>" +
//            "ORDER BY goods.actual_price ASC" +
//            "</when>" +
//            "<when test='sort==lql'>" +
//            "ORDER BY goods.coupon_receive_num DESC" +
//            "</when>" +
//            "<when test='sort==yj'>" +
//            "ORDER BY goods.commission DESC" +
//            "</when>" +
            "</script>")
    List<GoodsTaobaoListDto> goodsList(Page page, @Param("brandKey") String brandKey,@Param("sort") String sort);
}
